package huoye.shops.huoye.operation.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.codeideology.android.lang.entity.Paging;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import java.io.Serializable;
import java.util.List;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.base.BaseActivity;
import huoye.shops.base.PullToRefreshActivity;
import huoye.shops.huoye.operation.adapter.CurUserLotteryInfosAdapter;
import huoye.shops.huoye.operation.model.CurUserLotteryInfos;
import huoye.shops.huoye.operation.model.EventInfo;
import huoye.shops.huoye.operation.presenter.CurUserLotteryInfosPresenter;
import huoye.shops.huoye.operation.view.ICurUserLotteryInfosView;

public class CurUserLotteryInfosActivity extends BaseActivity implements ICurUserLotteryInfosView {

    private CurUserLotteryInfosPresenter mCurUserLotteryInfosPresenter;
    private CurUserLotteryInfosAdapter adapter;
    private EventInfo eventInfo;


    @BindView(R.id.curuser_lottery_infos_rv)
    RecyclerView rv;


    @Override
    protected int getContentViewId() {
        return R.layout.activity_curuser_lottery_infos;
    }

    @Override
    protected void initView(@Nullable Bundle bundle) {
        setTitle("中奖用户列表");
        eventInfo = getIntentData();
        mCurUserLotteryInfosPresenter = new CurUserLotteryInfosPresenter();
        mCurUserLotteryInfosPresenter.addTaskListener(this);
        mCurUserLotteryInfosPresenter.onStart();
        mCurUserLotteryInfosPresenter.getCurUserLotteryInfos(eventInfo.getEventId());
    }



    @Override
    public void setAdapter(List<CurUserLotteryInfos> list) {
        adapter = new CurUserLotteryInfosAdapter(this);
        adapter.setData(list);
        rv.setLayoutManager(new LinearLayoutManager(this));
        rv.setAdapter(adapter);
    }
}
